package application;

import org.apache.wicket.authroles.authentication.AuthenticatedWebApplication;
import org.apache.wicket.authroles.authentication.AuthenticatedWebSession;
import org.apache.wicket.markup.html.WebPage;
import org.apache.wicket.spring.injection.annot.SpringComponentInjector;

import web.LoginPage;
import web.SpringWicketWebSession;

public class SpringWicketApplication extends AuthenticatedWebApplication {

	boolean isInitialized = false;

	@Override
	protected void init() {
		if (!isInitialized) {
			super.init();
			setListeners();
			isInitialized = true;
		}
	}

	private void setListeners() {
		getComponentInstantiationListeners().add(new SpringComponentInjector(this));
	}

	public Class<? extends WebPage> getHomePage() {
		return LoginPage.class;
	}

	@Override
	protected Class<? extends AuthenticatedWebSession> getWebSessionClass() {
		return SpringWicketWebSession.class;
	}

	@Override
	protected Class<? extends WebPage> getSignInPageClass() {
		return LoginPage.class;
	}
}